package com.xw.kotlinlib.network

import okhttp3.Interceptor
import okhttp3.Response
import java.util.*

/**
 * 蜂巢接口签名认证token.
 */
class AuthorizationInterceptor: Interceptor {

    override fun intercept(chain: Interceptor.Chain): Response {

        val originalRequest = chain.request()
        val newRequestBuilder = originalRequest.newBuilder()

        // TODO: 这里可以加入 http请求的header
//        val libUser = LibUserManager.getUser(LibServerConfig.context())
//        val token = libUser?.accessToken ?: ""
//
//        newRequestBuilder.addHeader("moc-access-token", token)
//        newRequestBuilder.addHeader("Content-Type", " application/json")

        val headerRequest = newRequestBuilder.build()
        return chain.proceed(headerRequest)
    }
}